package com.woniu.tms.web.filter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class Config implements WebMvcConfigurer {

    @Autowired
    LoginInterceptor loginInterceptor;
    @Autowired
    PermissionInterceptor permissionInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor).addPathPatterns("/**").excludePathPatterns("/public/**", "/login.jsp", "/captcha", "/login/loginDo", "/userInfo/info/index",
                "/userInfo/info/indexDo", "/userInfo/info/edit", "/userInfo/pwd/index", "/userInfo/pwd/edit");
        registry.addInterceptor(permissionInterceptor).addPathPatterns("/**").excludePathPatterns("/public/**", "/login.jsp", "/captcha", "/login/exitDo", "/login/loginDo", "/userInfo/info/index",
                "/userInfo/info/indexDo", "/userInfo/info/edit", "/userInfo/pwd/index", "/userInfo/pwd/edit");
    }
}
